#include <string.h>
#include <iostream>
using std::cout;
using std::endl;

class String{
public:
    String()
    :_pstr(new char[1]())
    {
        cout << "String()" << endl;
    }
    //explicit 禁止隐式类型转换
    String(const char * pstr)
    :_pstr(new char[strlen(pstr) + 1]())
    {
        strcpy(_pstr, pstr);
        cout << "String(const char *)" << endl;
    }
    String(const String & rhs);
    String & operator=(const String & rhs);
    bool empty() const;
    int size() const;
    const char * c_str() const;
    ~String();
    String & append(String & rhs);
    String & append(const char * pstr);

private:
    char * _pstr;
};


void test(){
    String s1;
    String s2("hello");
    //cout << s1 << endl;
    //cout << s2 << endl;
    cout << "================" << endl;
    String s3 = "world";
    
}

int main()
{
    test();
    return 0;
}

